#include<bits/stdc++.h>
#define int __int128
#define rep(i,a,b) for(int i(a);i<=(b);++i)
#define req(i,a,b) for(int i(a);i>=(b);--i)
#define sort stable_sort
using namespace std;
char buf[1<<23],*p1=buf,*p2=buf,ubuf[1<<23],*u=ubuf;
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
template<typename TP> inline TP read(TP &num)
{
	TP x=0;
	int f=0;
	char ch=getchar();
	while(ch<48||ch>57) f|=ch=='-',ch=getchar();
	while(48<=ch&&ch<=57) x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return num=f?-x:x;
}
template<typename ...Args> inline void read(Args &...args)
{
	(read(args),...);
}
template<typename TP> inline void write(TP x)
{
	(x<0)?(putchar('-'),x=-x):0;
	(x>9)?(write(x/10),0):0;
	putchar((x%10)^48);
}
template<typename TP> inline void writeln(TP x)
{
	write<TP>(x);
	puts("");
}
int n,k;
constexpr int mod=1000000007;
inline int qpow(int x,int y)
{
	int ans=1;
	while(y)
	{
		if(y&1) ans=ans*x%mod;
		x=x*x%mod;
		y>>=1;
	}
	return ans;
}
vector<int> a;
inline void force()
{
	int ans=0,ways=0;
	function<void(vector<int>)> dfs=[&](vector<int> s)
	{
		if(s.size()==n-k) return ++ways,ans+=accumulate(s.begin(),s.end(),0ll),void();
		int m=s.size(); rep(i,0,m-2)
		{
			vector<int> ns=s;
			ns[i]-=ns[i+1];
			ns.erase(ns.begin()+i+1);
			dfs(ns);
		}
	};
	dfs(a);
	writeln((ans%mod*qpow(ways,mod-2)%mod+mod)%mod);
	// x 1; y y y y y y -> ans=(x-2)*y
	// k=1:	5: a[1]+1/2(==2/4)*(a[2]+...+a[n]); 6: a[1]+3/5*(a[2]+...+a[n]);
	//		7: a[1]+2/3(==4/6)*(a[2]+...+a[n]);
}
inline void k0(){writeln((accumulate(a.begin(),a.end(),0ll)%mod+mod)%mod);}
inline void k1()
{
	writeln(((a[0]+accumulate(a.begin()+1,a.end(),0ll)%mod*(n-3)%mod*qpow(n-1,mod-2)%mod)%mod+mod)%mod);
}
inline void k2()
{
	// a[0]+a[1]*(n-5)/(n-1)+(a[2]+...+a[n-1])*((n-3)*(n-4)/2)/((n-1)*(n-2)/2)
	writeln(((a[0]+a[1]*(n-5)%mod*qpow(n-1,mod-2)%mod+accumulate(a.begin()+2,a.end(),0ll)%mod*(n-3)%mod*(n-4)%mod*qpow(n-1,mod-2)%mod*qpow(n-2,mod-2)%mod)%mod+mod)%mod);
}
inline void kkk()
{
	int ans=(a[0]+a[1]*(n-2*k-1)%mod*qpow(n-1,mod-2)%mod+mod)%mod;
	int Mul=1,Div=1;
	rep(i,3,k+2) Mul=Mul*(n-i)%mod;
	rep(i,1,k) Div=Div*(n-i)%mod;
	writeln(((ans+accumulate(a.begin()+2,a.end(),0ll)%mod*Mul%mod*qpow(Div,mod-2)%mod)%mod+mod)%mod);
	// a[0]+a[1]*(n-7)/(n-1)+...
}
#define DEBUG 0
signed main()
{
	freopen("game.in","r",stdin);
	freopen("game.out","w",stdout);
	read(n,k),a.resize(n);
	rep(i,0,n-1) read(a[i]);
	if(!DEBUG&&n<=10) force();
	else if(!k) k0();
	else if(k==1) k1();
	else if(k==2) k2();
	else kkk();
	return 0;
}
